package org.paraj.mapreduce;

import java.util.Collection;
import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: piotrga
 * Date: Nov 11, 2008
 * Time: 8:34:50 PM
 * To change this template use File | Settings | File Templates.
 */

/**
 * This interface has been extracted from ComplexTask to allow for creating reusable aggregators like AverageAggregator.
 * It also allows serializing state, if state created by generateTasks is needed during aggregation process. However this is not recommended.
 * The state can be then serialized with aggregation task and send to the distributor.
 *  
 * @param <RESULT>
 * @param <INTERMEDIATE>
 */
public interface ResultAggregator<RESULT, INTERMEDIATE> extends Serializable {
    RESULT aggregate(Collection<INTERMEDIATE> results);
}
